package com.senior.sendmessage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.senior.sendmessage.entity.Book;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author bjl_m
 */
@Mapper
public interface BookMapper extends BaseMapper<Book> {
    /**
     * 得到书
     *
     * @return {@link List}<{@link Book}>
     */
    @Select("select * from book")
    List<Book> getBook();

    /**
     * 保存的书
     *
     * @param book 书
     */
    @Insert("INSERT INTO book(name,author,hobby) VALUES(#{book.name},#{book.author},#{book.hobby})")
    void saveBook(@Param("book") Book book);
}
